package com.sh.Enum.Two;

import cn.hutool.json.JSONObject;

public enum StatusPublicEnum {
    FAIL("失败", "300", "认证系统"),
    OK("成功", "200", "认证系统");

    private final String code;
    private final String msg;
    private final String status;


    StatusPublicEnum(String status, String code, String msg) {
        this.msg = msg;
        this.status = status;
        this.code = code;
    }

    public String toJson() throws Exception {
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("msg", this.msg);
        jsonObject.put("status", this.status);
        jsonObject.put("code", this.code);
        return jsonObject.toString();
    }

    public static void main(String[] args) throws Exception {
        System.out.println(StatusPublicEnum.FAIL.code);
        System.out.println(StatusPublicEnum.FAIL.toJson());
        System.out.println(StatusPublicEnum.OK.toJson());
    }

}
